package com.sh.doctors.cloud.patient.model.local.dao

import androidx.room.*
import com.sh.doctors.cloud.resp.AriticleBean
import io.reactivex.Single

/**
 * 资讯db 执行插入，查询， 删的操作
 */
@Dao
interface AriticleDao {

    @Insert(onConflict = OnConflictStrategy.REPLACE)
    fun insetAll(articles: List<AriticleBean>)

    @Query("SELECT * FROM articles ")
    fun getAllArticle(): Single<List<AriticleBean>>

    @Query("SELECT * FROM articles WHERE news_id=:news_id")
    fun getAriticleById(news_id: String): Single<AriticleBean>


    @Insert(onConflict = OnConflictStrategy.REPLACE)
    fun insertArticle(article: AriticleBean)

    @Delete
    fun delete(article: AriticleBean);
}